package com.semidata.rtd.engine.dynamic;

import java.io.IOException;
import java.net.URI;

import javax.tools.SimpleJavaFileObject;

public class JavaSourceInMemory extends SimpleJavaFileObject {
	private final String code;

	public JavaSourceInMemory(String name, String code) {
		super(URI.create("memo:///" + name.replace('.', '/')
				+ Kind.SOURCE.extension), Kind.SOURCE);
		this.code = code;
	}

	@Override
	public CharSequence getCharContent(boolean ignoreEncodingErrors)
			throws IOException {
		return this.code;
	}
}